<template>
  <div class="start">
    <van-nav-bar title="7.15执法公众开放日活动" />
    <div class="whitediv">
      <div class="headerimg">
        <img
          src="https://img2.baidu.com/it/u=625256387,191126542&fm=253&fmt=auto&app=138&f=JPEG?w=640&h=492"
          alt=""
        />
      </div>
      <p class="info">长按关注视频号</p>
      <p>并为视频号点赞</p>

      <div class="erweimaback">
        <img class="back" src="../assets/whiteback.png" alt="" />
        <img class="erweima" src="../assets/newerweima.jpg" alt="" />
      </div>

      <!-- <a
        class="subbtn"
        href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx387f02a7e5be1dda&redirect_uri=http%3A%2F%2Fcgh.montage-yy.com%2F%23%2Fanswer&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
        >开始答题</a
      > -->
      <!-- <button v-else @click="submit" class="submit">开始答题</button> -->
      <button  @click="submit" class="submit">开始答题</button>
    </div>
    <img class="hui" src="../assets/newhui.png" alt="" />
    <p class="bottom">上海市静安区城市管理管理行政执法局</p>
  </div>
</template>
<script>
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
// import axios from "axios";
export default {
  created() {
    var alreaalreadyfinish = localStorage.getItem("alreadyfinish");
    if (alreaalreadyfinish) {
      this.$router.push("/Message");
    }

    var timestamp =Math.round(new Date().getTime()/1000)
    var endtime=1657900799
    if(timestamp>endtime){
      this.$router.push('/alreayend')
    }

    // console.log(timestamp>1657529700)


    var control=this.$store.state.currentque
    var ifone=this.$store.state.ifone
    if(control>0){
      this.$router.push('/answer')
    }
    if(control==0 && ifone){
      this.$router.push('/answer')
    }
    if(control==-1){
      this.$router.push('/Finish')
    }

  },
  setup() {
    const router = useRouter();
    const code = ref();
    const show = ref(false);
    const onClickLeft = () => history.back();
    const submit = async () => {
      router.push("/Thanks");
      // var res = await axios.post("/api/login/register", {
      //   code: "0011x9100o45bO172N100sjsxo41x91-",
      // });
      // if (res.data.code == "200") {
      //   nickname.value = res.data.data.user.name;
      //   headimgurl.value = res.data.data.user.imgs;
      //   sessionStorage.setItem("uid", res.data.data.user.id);
      //   sessionStorage.setItem("token", res.data.data.access_token);
      // }
    };
    onMounted(() => {
      // var alreaalreadyfinish = localStorage.getItem("alreadyfinish");
      // if(alreaalreadyfinish){
      //   show.value=true

      // }
      // let local = encodeURIComponent("http://cgh.montage-yy.com/#/answer");
      // console.log(local);
    });
    return {
      onClickLeft,
      submit,
      code,
      show,
    };
  },
};
</script>
<style scoped>
.start {
  height: 100%;
  background-color: #1157e5;
}
.whitediv {
  position: absolute;
  top: 15%;
  left: 5%;
  width: 90%;
  background-color: white;
  border-radius: 0.7rem;
  height: 65%;
}
.headerimg {
  position: absolute;
  top: -1.6rem;
  left: 50%;
  transform: translate(-50%, 0);
  width: 25%;
  height: 3.2rem;
  border-radius: 50%;
  background-color: aquamarine;
  border: 1px solid #eee;
}
.headerimg img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #eee;
  box-shadow: 0 0 10px #ddd;
}
.info {
  margin-top: 2.3rem;
}
.whitediv p {
  font-size: 0.6rem;
  text-align: center;
}
.erweimaback {
  position: relative;
  width: 72%;
  height: 50%;
  margin-left: 14%;
}
.back {
  position: absolute;
  width: 100%;
  height: 100%;
}
.erweima {
  position: absolute;
  margin-left: 10%;
  margin-top: 10%;
  width: 80%;
  height: 80%;
}
.submit {
  background-color: #1f62e6;
  width: 50%;
  color: white;
  border-radius: 8px;
  height: 1.5rem;
  font-size: 0.7rem;
  border: none;
  margin-left: 25%;
  margin-top: 1.4rem;
}
.subbtn {
  display: inline-block;
  background-color: #1f62e6;
  width: 50%;
  color: white;
  border-radius: 8px;
  text-align: center;
  line-height: 1.5rem;
  height: 1.5rem;
  font-size: 0.7rem;
  border: none;
  margin-left: 25%;
  margin-top: 1.4rem;
}
.hui {
  position: absolute;
  top: 82%;
  left: 50%;
  transform: translate(-50%, 0);
  width: 2.5rem;
  height: 2.2rem;
}
.bottom {
  width: 100%;
  position: absolute;
  top: 89%;
  color: white;
  text-align: center;
  font-size: 0.5rem;
}
</style>
